﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GUI.Custom_Classes;

namespace LEET.LEETCommon.Model
{
    public class Script : IScript
    {
        IList<String> instructions = new List<String>();

        public Script(String name)
        {
            Name = name;
        }

        public Script(String name, IEnumerable<String> instructions)
        {
            Name = name;
            foreach (String ins in instructions)
                AddScriptItem(ins);
        }

        public void AddScriptItem(IEvent_Pair ep)
        {
            instructions.Add(ep.Details);
        }

        public void AddScriptItem(StandardScriptItems.IScriptBuilder builder)
        {
            instructions.Add(builder.ToString());
        }

        public void AddScriptItem(string ins)
        {
            instructions.Add(ins);
        }

        public void Clear()
        {
            instructions.Clear();
        }

        public bool IsEmpty
        {
            get { return instructions.Count == 0; }
        }

        public int Count
        {
            get { return instructions.Count; }
        }

        public string Last
        {
            get { return instructions.Last(); }
        }

        public void RemoveAt(int i)
        {
            instructions.RemoveAt(i);
        }

        public void RemoveSelected()
        {
            
        }

        public IEnumerator<string> GetEnumerator()
        {
            return instructions.GetEnumerator();
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return instructions.GetEnumerator();
        }

        public string Name
        {
            get;
            private set;
        }
    }
}
